# Copyright (c) 2019 Presto Labs Pte. Ltd.
# Author: xguo

import json
import dateutil.parser

from coin.base.datetime_util import iterate_date


def main():
  start_date = dateutil.parser.parse('20190515')
  end_date = dateutil.parser.parse('20190520')

  jobs_config = {'name': 'feed_dumper', 'working_dir': '/remote/iosg/home/xguo/slurm', 'jobs': []}
  jobs = jobs_config['jobs']

  for trading_date in iterate_date(start_date, end_date):
    trading_date_str = trading_date.strftime('%Y%m%d')
    command = f'source /remote/iosg/home/xguo/pyrunner/pyrunner.sh && ./pyrunner coin/experimental/xguo/fruit/feed_dumper/feed_dumper.py --trading_date={trading_date_str}'
    jobs.append({
        'name': trading_date_str,
        'command': command,
    })
  print(json.dumps(jobs_config, indent=2))


if __name__ == '__main__':
  main()
